<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.*" %>
<%@ page import="domain.Contact" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" media="screen, projection" href="scripts/demo.css" />
<script type="text/javascript" src="scripts/jquery-1.4.1.js"></script>
<script type="text/javascript" src="scripts/jconfirmaction.jquery.js"></script>
<script type="text/javascript">
			$(document).ready(function() {
				$('.ask').jConfirmAction();
			});
			
</script>
<title>Contact list</title>
</head>
<body>
	
	<%@include file="header.jsp" %>
	<% List<Contact> contacts = (List<Contact>)request.getAttribute("listContact");
	if (contacts != null && contacts.size()> 0){ %>
	
	<table border="1" id="container">
	<thead>
		<tr><th>First Name</th><th>Last Name</th><th>Email</th><th>Actions</th></tr>   
	</thead>
	<%for(Contact c : contacts)
	{%>
	<tr>
	<td><%=c.getFirstName()%></td><td><%=c.getLastName()%></td><td><%=c.getEmail()%></td>
	<td><a href=<%="\"EditContact?id="+c.getIdContact()+"\""%>><img src="img/edit.jpg" alt="edit contact"/></a>
	<a href=<%="\"DeleteContact?id="+c.getIdContact()+"\""%> class="ask"><img src="img/delete.png" alt="delete contact"/></a></td>
	</tr>		
	<%}
	%>
	</table>
	<%}else {%>
	<i>No contact to display !! </i>
	<%}%>
</body>
</html>